#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include "./01-ui/03-text_edit/texteditdialog.h"
#include "./01-list/01-q_list_view/qlistviewdialog.h"
#include "./02-socket/01-imap/imapstudialog.h"
#include "./02-socket/02-pop3/pop3studialog.h"
#include "./02-socket/03-smtp/smtpstudialog.h"
#include "./05-thread/threadstudialog.h"
#include "./01-list/03-q_tree_view/qtreeviewstudialog.h"
#include "./04-string/stringstudialog.h"
#include "./01-ui/03-text_edit/richeditorwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);


    //排列


}

MainWindow::~MainWindow()
{
    delete ui;
}

// void MainWindow::on_pushButton_clicked()
// {
//     QListWidgetItem * item = new QListWidgetItem();
//     item->setText("111");

//     // connect(item,&QListWidget::pressed,[=](QModelIndex pos){
//     //     qDebug()<<"m_ListWidget pos.row:"<<pos.row();
//     // });


//     //如何访问到ui界面构建的对象?
//     //ui中声明的元素,都是有名字的,通过名字访问.
//     this->ui->listWidget->addItem(item);

//     // connect(this->ui->listWidget,&QListWidget::pressed,this,&MainWindow::onClickItem);
//     connect(this->ui->listWidget,&QListWidget::pressed,[=](QModelIndex pos){
//         qDebug()<<"m_ListWidget pos.row:"<<pos.row();
//     });


//     //我们可以通过信号和槽的方式对列表控件的选项进行响应，例如
//     // connect(ui->m_ListWidget, SIGNAL(currentTextChanged(QString)),this, SLOT(textChanged(QString)));

// }

void MainWindow::onClickItem() {
    qDebug()<<"clicked";
}


void MainWindow::on_pushButton_2_clicked()
{
    QListViewDialog * dialog = new QListViewDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_3_clicked()
{
    ImapStuDialog * dialog = new ImapStuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_5_clicked()
{
    QTreeViewStuDialog * dialog = new QTreeViewStuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_9_clicked()
{
    Pop3StuDialog * dialog = new Pop3StuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_10_clicked()
{
    SmtpStuDialog * dialog = new SmtpStuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_11_clicked()
{
    ThreadStuDialog * dialog = new ThreadStuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_12_clicked()
{
    StringStuDialog * dialog = new StringStuDialog(this);
    dialog->show();
}


void MainWindow::on_pushButton_14_clicked()
{
    TextEditDialog * dialog = new TextEditDialog(this);
    dialog->show();
}


/**
 * @brief MainWindow::on_pushButton_15_clicked
 * TextEditWindow
 */
void MainWindow::on_pushButton_15_clicked(){
    // RichEditorWindow richEditorWindow;
    // richEditorWindow.show();
    RichEditorWindow * window = new RichEditorWindow();
    window->show();
}

